home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10282 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.7 KB  |  59 lines

  1. Path: solon.com!not-for-mail
  2. From: jyacc!marks!jtrigg@uunet.uu.net (Jim Trigg)
  3. Newsgroups: comp.lang.c,comp.lang.c.moderated,hp.unix,comp.sys.hp.apps,comp.sys.hp.hpux
  4. Subject: Re: C coding problem
  5. Date: 16 Mar 1996 09:44:02 -0600
  6. Organization: JYACC, Inc.
  7. Sender: clc@solutions.solon.com
  8. Approved: clc@solutions.solon.com
  9. Message-ID: <4ienk2$a5t@solutions.solon.com>
  10. References: <4ianbf$h86@solutions.solon.com>
  11. NNTP-Posting-Host: solutions.solon.com
  12. X-Nntp-Posting-Host: marks
  13. X-Newsreader: Gnus v5.1
  14.  
  15. In article <4ianbf$h86@solutions.solon.com> proctor@corp.hp.com
  16. (Stephen Proctor) writes:
  17.  
  18. > I am trying to write a *simple* C program and am running into the following
  19. > warning problem shown below.  Why do I get this warning?  
  20.  
  21. > It seems to have an effect on the logic of the program when executed.
  22.  
  23. > I am try to examine the first character in a command line argument, argv[],
  24. > to the program for the presence of a "-" sign to identify the argument as
  25. > an option.
  26.  
  27. > % c89 shell.c -o shell
  28. > cc: "shell.c", line 98: warning 608: Illegal integer-pointer 
  29. > combination in assignment.
  30.  
  31. > 2.) The program is as follows,
  32.  
  33. > #include <stdio.h>
  34. > #include <ctype.h>
  35. > #include <string.h>
  36. > #include <stdlib.h>
  37.  
  38. > main(int argc, char *argv[])
  39. > {
  40. >    int ii;
  41. >    int option_val = 0;
  42. >    /* skip lines */
  43. >    for (ii=1; ii<argc; ii++) {
  44. >    /* skip lines */
  45. >    /* The next line is the offending line */
  46. >    if (*argv[ii] == '-') option_val = read_options;
  47.                        ^^^^^^^^^^^^
  48. >    /* skip lines */
  49. >    return 0;         /* Program executed successfully */
  50. > }
  51.  
  52. What is read_options?  If it is a function, the assignment should be:
  53.     option_val = read_options();
  54. Otherwise you are trying to assign the address of the function to
  55. option_val and that is your problem.
  56.  
  57. Just a Thought,
  58. Jim Trigg
  59.